package cate.game.role.res.guild.msg.basic;

import cate.game.GameBody;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdGuild;
import easy.java.practice.errorcode.EcResult;

@ClientMsg(title = "解散公会 的 请求")
public class DisbandGuildReq implements MsgInput {
    public DisbandGuildReq() {
    }

    @Override
    public MsgConfig conf() {
        return MsgIdGuild.DISBAND_GUILD_REQ;
    }

    @Override
    public void execute(GameBody game, ClientContext cc) {
        if (cc.getRole().getRes().guild.checkGuild().ok()) {
            EcResult r = game.res.guild.deleteGuild(cc.getRole());
            if (!r.ok())
                game.notice.message(cc.getRole(), r.fail());
        }
    }
}
